﻿using System.Collections.ObjectModel;

namespace CYPlayer.ViewModel
{
    using System.ComponentModel;
    using System.Windows;
    using System.Windows.Input;
    using DataClasses;
    using global::ViewModel;

    public class PlaylistWindowVM : PlaylistsSongsVM
    {
        #region Constructors

        private SongVM _selectedSong;

        public PlaylistWindowVM()
        {
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }

            if (Playlists.Count != 0)
            {
                SelectedPlaylist = Playlists[0];
            }
        }

        #endregion 

        public override SongVM SelectedSong
        {
            get
            {
                return _selectedSong;
            }

            set
            {
                _selectedSong = value;
                App.PlayerWindowVM.SelectedSong = _selectedSong;
                RaisePropertyChanged("SelectedSong");
            }
        }

        // ICommand PlaySelected { get { return new RelayCommand(p => PlaySelectedExecute()); } }
        #region Commands

        // void PlaySelectedExecute()
        // {
        //    App.PlayerWindowVM.SelectedSong = _selectedSong;
        // }
        #endregion
    }
}